#include <vector>
using namespace std;
int findMin(vector<int> &nums) {
  int left = 0;
  int right = nums.size() - 1;
  if (right == 0) {
    return nums[0];
  }
  int mid = -1;
  while (left < right) {
    mid = (left + right) / 2;
    if (nums[mid] < nums[right]) {
      right = mid;
    } else {
      left = mid + 1;
    }
  }
  return nums[right];
}